//
//  FriendTableViewController.m
//  Final
//
//  Created by lanou3g on 15/12/5.
//  Copyright © 2015年 皮比诺. All rights reserved.
//

#import "FriendTableViewController.h"
#import "FriendTableViewCell.h"
#import "chattingViewController.h"
@interface FriendTableViewController ()<UITableViewDataSource, UITableViewDelegate, FriendTableViewcellDeldegate>
@property(nonatomic,strong)FriendTableViewCell *cell;
@end

@implementation FriendTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    
    [self.tableView registerClass:[FriendTableViewCell class] forCellReuseIdentifier:@"cell"];
    

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 2;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    self.cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    
    
//    self.cell.backgroundColor = [UIColor greenColor];

    if (indexPath.row == 0) {
        [self.cell.button setTitle:@"我的好友" forState:(UIControlStateNormal)];
        
    }else if (indexPath.row == 1){
        
        [self.cell.button setTitle:@"群组" forState:(UIControlStateNormal)];
    }
    
    
    
    
 
    self.cell.button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    self.cell.button.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
    self.cell.button.backgroundColor = [UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1];

    self.cell.Delegate = self;
    
    
    return self.cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (self.cell.button.selected == YES) {
        return 44 + 44*5;
    }else{
        
        return 46;
    }
    
    
    return 44;
}
//cell代理方法
- (void)roloadTableview
{
    [self.tableView reloadData];
    
}
- (void)popTochatViewController:(NSString *)str
{
    chattingViewController *chatting = [[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"chattingVc"];
    
    [self.navigationController pushViewController:chatting animated:YES];
    
}


//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//{
//    
//    return 50;
//    
//}
//
//-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    
//    return 44;
//}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
